import request from '@/utils/request'

export function list(query) {
    if (process.env.VUE_APP_SHOPNAME == '五集时代') {
        return request({
            url: '/sys/user/list',
            method: 'get',
            params: query
        })
    } else {
        return request({
            url: '/sys/users/list',
            method: 'get',
            params: query
        })
    }
}

export function info(id) {
    if (process.env.VUE_APP_SHOPNAME == '五集时代') {
        return request({
            url: '/sys/user/info/' + id,
            method: 'get'
        })
    } else {
        return request({
            url: '/sys/users/info/' + id,
            method: 'get'
        })
    }
}

export function save(data) {

    if (process.env.VUE_APP_SHOPNAME == '五集时代') {

        return request({
            url: '/sys/user/save',
            method: 'post',
            data
        })
    } else {
        return request({
            url: '/sys/users/save',
            method: 'post',
            data
        })
    }
}

export function update(data) {
    if (process.env.VUE_APP_SHOPNAME == '五集时代') {
        return request({
            url: '/sys/user/update',
            method: 'post',
            data
        })
    } else {
        return request({
            url: '/sys/users/update',
            method: 'post',
            data
        })
    }
}

export function remove(data) {
    if (process.env.VUE_APP_SHOPNAME == '五集时代') {
        data.json = true
        return request({
            url: '/sys/user/delete',
            method: 'post',
            data
        })
    } else {
        return request({
            url: '/sys/users/delete',
            method: 'post',
            data
        })
    }
}

export function getRoles() {
    return request({
        url: '/sys/role/select',
        method: 'get'
    })
}
